﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PlatWL.Data;

namespace PlatWL.Services.ServicesWeb
{
    public class AdvertManage
    {

        /// <summary>
        /// 
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="Client"></param>
        /// <param name="type">1.首页，2.视频页</param>
        /// <param name="top"></param>
        public void GetHotList(ref Msg_Result msg, int Client, int type, int top)
        {
            //var db = new PlatWLEntities();
            //DateTime now = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));

            //var list = from p in db.pt_info_advert
            //           where p.Client == Client && p.IsShelf == 1 && p.Type1 == type && p.StartDate <= now && p.EndDate >= now
            //           select p;
            //list = list.OrderBy(p => p.Sort).ThenByDescending(p => p.CRTime);
            //list = list.Take(top);

            //new pt_info_advertb().GetDataPager("pt_info_advert","*",)

            //msg.result = list.ToList();
            //msg.total = list.ToList().Count();

        }

        public void GetModel(ref Msg_Result msg,int Client, int ID)
        {
            new pt_info_advertb().ExsSql("update pt_info_advert set ViewQty=IFNULL(ViewQty,0)+1 where ID=" + ID);
            msg.result = new pt_info_advertb().GetEntity(d => d.ID == ID && d.IsShelf == 1);
        }


    }
}
